<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <style media="screen">
      .fixed{
        width: 100px;
        height: 100px;
        background-color: #f99;
        position: fixed;
        top: -100px;
        left: 0;
        right: 0;
        margin: auto;
        transition: .5s;
      }
      .aaa{
        width: 100px;
        height: 100px;
        background: red;
      }
    </style>
  </head>
  <body>
    <div class="fixed"></div>
    <div class="aaa">

    </div>
    <script type="text/javascript">
      document.getElementsByClassName('aaa')[0].addEventListener('click', function(){
        var interval = 10;
        var start = -100;
        setTimeout(function go() {
          start = start + interval;
          document.getElementsByClassName('fixed')[0].style.top = start + 'px';
          if (start <= 30) {
            go();
          }
        }, 1000);
      })
    </script>
  </body>
</html>
